//
// Created by user on 2022/2/24.
//
#include <vector>
#include<iostream>
#include<algorithm>
using namespace std;
vector<int> relativeSortArray(vector<int>& arr1, vector<int>& arr2) {
    int max = *max_element(arr1.begin(), arr1.end());
    vector<int> count(max + 1);
    for (int num : arr1) count[num]++;

    int index = 0;
    for (int num : arr2) {
        for (int i = 0; i < count[num]; i++) {
            arr1[index++] = num;
        }
        count[num] = 0;
    }

    for (int i = 0; i <= max; i++) {
        for (int k = 0; k < count[i]; k++) {
            arr1[index++] = i;
        }
    }

    return arr1;
}


bool cmp(int a,int b)
{
    return a<b;
}
int main()
{
    int num[]={2,3,1,6,4,5};
    cout<<"最小值是 "<<*min_element(num,num+6)<<endl;
    cout<<"最大值是 "<<*max_element(num,num+6)<<endl;
    cout<<"最小值是 "<<*min_element(num,num+6,cmp)<<endl;
    cout<<"最大值是 "<<*max_element(num,num+6,cmp)<<endl;
    return 0;
}